<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        .container{
            width: 600px;
            margin: 0 auto;
            padding: 30px;
            background-color: #e0e0e0;
        }
        .price{
            font-size:30px;
            color:#f00;
            font-family: 'monaco';
            font-weight: 700;
        }
    </style>
</head>
<body>
<div class="container">
    <h1>BTC 行情</h1>
    <hr>

    <ul id="btc">

    </ul>
</div>


{js href="__JS__jquery.min.js"}
<script>
    getAJAX();

    setInterval(getAJAX, 8000);


    function getAJAX(){
        $.ajax({
            url: "{:url('index/btc/getPrices')}",
            method : 'get',
            dataType : 'json',
            success : function (data){
                // console.log(data);
                $('#btc').empty();
                for (var i in data) {
                    $('<li>', {
                        'class' : 'price',
                        text: i + ' : ' + data[i].buy.toFixed(2) + data[i].symbol
                    }).appendTo('#btc');
                }
            }
        });


        $('#btc').slideToggle(3000);

    }
    
</script>
</body>
</html>